# Papal State
country_event = {
	id = 1081
	title = "EVTNAME1081"
	desc = "EVTDESC1081"
	picture = POPE_PREACHING_eventPicture
	
	trigger = {
		papacy_active = yes
		owns = 118		# Rome
		normal_or_historical_nations = yes
		religion = catholic
		NOT = { tag = ITA }
		NOT = { tag = ROM }
		NOT = { tag = HLR }
		NOT = { exists = PAP }
		NOT = { has_country_flag = no_support }
	}
	
	mean_time_to_happen = {
		months = 2
		
		modifier = {
			factor = 0.95
			num_of_cardinals = 1
		}
		modifier = {
			factor = 0.95
			num_of_cardinals = 2
		}
		modifier = {
			factor = 0.75
			has_idea_group = religious_ideas
		}
		modifier = {
			factor = 0.9
			is_defender_of_faith = yes
		}
		modifier = {
			factor = 1.1
			NOT = { is_defender_of_faith = yes }
		}
		modifier = {
			factor = 1.1
			NOT = { advisor = theologian }
		}
		modifier = {
			factor = 0.9
			theologian = 2
		}
	}
	
	option = {
		name = "EVTOPTA1081" # We will never support such a state
		ai_chance = { factor = 25 }
		add_prestige = -10
		add_stability = -1
		every_country = {
			limit = {
				religion = catholic
				NOT = { tag = ROOT }
			}
			add_opinion = { who = ROOT modifier = opinion_declined_independent_state_support }
		}
		set_country_flag = no_support
	}
	option = {
		name = "EVTOPTB1081" # Rome is rightfully theirs
		ai_chance = { 
			factor = 75 
			modifier = {
				factor = 0
				is_core = 118
			}
		}
		118 = {
			add_core = PAP
			cede_province = PAP
			if = {
				limit = {
					is_core = ROOT
				}
				remove_core = ROOT
			}
		}
		add_prestige = 25
		PAP = {
			change_religion = catholic
		}
	}
}

# The Papal State
country_event = {
	id = 1082
	title = "EVTNAME1082"
	desc = "EVTDESC1082"
	picture = POPE_PREACHING_eventPicture
	
	trigger = {
		papacy_active = yes
		NOT = { exists = PAP }
		NOT = { exists = ITA }
		religion = catholic
		government = theocracy
		NOT = { has_ruler_flag = refused_papacy }
		is_at_war = no
		NOT = { tag = TEU }
		NOT = { tag = LIV }
		num_of_cities = 2
		NOT = { num_of_cities = 5 }
		any_owned_province = {
			is_capital = no
			religion = catholic
			continent = europe
		}
		118 = {
			owner = {
				OR = {
					NOT = { religion = catholic }
					has_country_flag = no_support
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 6
		modifier = {
			factor = 0.5
			tag = AVI
		}
		modifier = {
			factor = 2.0
			capital_scope = {
				NOT = { religion = catholic }
			}
		}
		modifier = {
			factor = 0.95
			theologian = 3
		}
		modifier = {
			factor = 0.75
			NOT = { num_of_cities = 3 }
		}
		modifier = {
			factor = 0.5
			NOT = { num_of_cities = 2 }
		}
	}
	
	immediate = {
		hidden_effect = {
			random_owned_province = {
				limit = {
					is_capital = no
					religion = catholic
					continent = europe
					any_neighbor_province = {
						NOT = { owned_by = ROOT }
					}
				}
				set_province_flag = papal_province
			}
			random_owned_province = {
				limit = {
					is_capital = no
					religion = catholic
					continent = europe
					owner = {
						NOT = {
							any_owned_province = {
								has_province_flag = papal_province
							}
						}
					}
				}
				set_province_flag = papal_province
			}
		}
	}
	
	option = {
		name = "EVTOPTA1082"
		ai_chance = { factor = 100 }
		random_owned_province = {
			limit = {
				has_province_flag = papal_province
			}
			remove_core = ROOT
			add_core = PAP
			cede_province = PAP
			clr_province_flag = papal_province
		}
		add_papal_influence = 20
		add_prestige = 25
		PAP = {
			change_religion = catholic
		}
	}
	option = {
		name = "EVTOPTB1082"
		ai_chance = { factor = 0 }
		set_ruler_flag = refused_papacy
		add_prestige = -25
	}
}

# Lacking Support
country_event = {
	id = 1083
	title = "EVTNAME1083"
	desc = "EVTDESC1083"
	picture = POPE_PREACHING_eventPicture

	trigger = {
		NOT = { has_country_flag = unsupportive_cardinals }
		has_reform = papacy_reform
		overextension_percentage = 0.25
	}

	mean_time_to_happen = {
		months = 180

		modifier = {
			factor = 0.9
			NOT = { dip = 1 }
		}
		modifier = {
			factor = 0.9
			NOT = { adm = 1 }
		}
		modifier = {
			factor = 1.1
			adm = 4
		}
		modifier = {
			factor = 1.1
			adm = 5
		}
		modifier = {
			factor = 1.1
			adm = 6
		}
		modifier = {
			factor = 1.1
			stability = 2
		}
		modifier = {
			factor = 1.1
			stability = 3
		}
		modifier = {
			factor = 0.9
			NOT = { stability = -1 }
		}
		modifier = {
			factor = 0.9
			NOT = { stability = -2 }
		}
	}

	option = {
		name = "EVTOPTA1083"		# Hire someone to investigate the matter
		ai_chance = { factor = 55 }
		set_country_flag = unsupportive_cardinals
		add_country_modifier = {
			name = investigating_spies
			duration = 1825
		}
		add_treasury = -25
	}
	option = {
		name = "EVTOPTB1083"		# Just try to prove them wrong
		ai_chance = { factor = 45 }
		set_country_flag = unsupportive_cardinals
		random_list = {
			50 = { add_prestige = 5 }
			50 = { add_prestige = -5 }
		}		
	}
}

# Possible Infiltrator
country_event = {
	id = 1084
	title = "EVTNAME1084"
	desc = "EVTDESC1084"
	picture = POPE_PREACHING_eventPicture

	trigger = {
		NOT = { has_country_flag = cardinal_infiltrator }
		has_reform = papacy_reform
		NOT = { adm = 1 }
	}

	mean_time_to_happen = {
		months = 180

		modifier = {
			factor = 1.1
			advisor = spymaster
		}
		modifier = {
			factor = 1.1
			spymaster = 2
		}
		modifier = {
			factor = 1.1
			spymaster = 3
		}
		modifier = {
			factor = 0.9
			NOT = { stability = -1 }
		}
		modifier = {
			factor = 0.9
			NOT = { stability = -2 }
		}
		modifier = {
			factor = 1.1
			stability = 3
		}
		modifier = {
			factor = 1.1
			stability = 2
		}
	}

	option = {
		name = "EVTOPTA1084"		# Take his word for it
		ai_chance = { factor = 55 }
		set_country_flag = cardinal_infiltrator
		random = {
			chance = 40
			add_stability = -1
		}
	}
	option = {
		name = "EVTOPTB1084"		# Ask for some proof
		ai_chance = { factor = 45 }
		set_country_flag = cardinal_infiltrator
		add_country_modifier = {
			name = "infiltrator_in_the_cardinal_office"
			duration = 730
		}
	}
}
